target('supervisor')
    set_kind('binary')
    set_targetdir('bin')
    set_objectdir('.xmake/build/.obj')
    set_dependir('.xmake/build/.dep')
    set_warnings('all')
    set_languages('cxx11')

    if is_os('windows') then
        add_links('user32', 'advapi32')
        add_files('supervisor.rc')
    else
        before_build(function(t, p)
            cprint("${green}[%3d%%]:${clear} make res for linux", p.progress, t:name())
            os.execv('objcopy', {'-I', 'binary', '-B', 'i386', '-O', 'elf64-x86-64', 'res.zip', 'res.o'})
        end)

        after_build(function(t, p)
            os.execv('rm', {'-f', 'res.o'})
        end)

        add_links('pthread')
        add_files('res.o')
    end

    add_files('*.cc', '*.c')
target_end()